package com.heima.a07_demo.server.service;

import org.springframework.http.HttpEntity;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

import java.net.http.HttpHeaders;
import java.util.HashMap;
import java.util.Map;

import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
import java.util.HashMap;
import java.util.Map;

@Service
public class DeepLearningService {
    private final RestTemplate restTemplate = new RestTemplate();

    public Map<String, Object> callDeepLearning(String imagePath) {
        String flaskUrl = "http://10.21.242.96:5000/diagnose";
        Map<String, String> requestBody = new HashMap<>();
        requestBody.put("imagePath", imagePath);
        return restTemplate.postForObject(flaskUrl, requestBody, Map.class);
    }
}